﻿
Imports std

Public Class set_string_property
    Inherits wrappered_property(Of [set](Of String))

    Private Const default_separator As Char = character.newline
    Private Const default_ignore_empty_entities As Boolean = False
    Private Shared ReadOnly default_type As String = GetType(set_string_property).Name()

    Private ReadOnly separator As String = Nothing
    Private ReadOnly ignore_empty_entities As Boolean = False

    Protected Sub New(ByVal id As Int64,
                      ByVal name As String,
                      ByVal type As String,
                      Optional ByVal separator As String = default_separator,
                      Optional ByVal ignore_empty_entities As Boolean = default_ignore_empty_entities)
        MyBase.New(id, name, type, bytes_set_string(separator, ignore_empty_entities))
    End Sub

    Public Shared Shadows Function ctor(ByVal id As Int64,
                                        ByVal name As String) As iproperty
        Return New set_string_property(id, name, default_type)
    End Function
End Class

Public Class cached_set_string_property
    Inherits wrappered_property(Of [set](Of String))

    Private Const default_separator As Char = character.newline
    Private Const default_ignore_empty_entities As Boolean = False
    Private Shared ReadOnly default_type As String = GetType(cached_set_string_property).Name()

    Private ReadOnly separator As String = Nothing
    Private ReadOnly ignore_empty_entities As Boolean = False

    Protected Sub New(ByVal id As Int64,
                      ByVal name As String,
                      ByVal type As String,
                      Optional ByVal separator As String = default_separator,
                      Optional ByVal ignore_empty_entities As Boolean = default_ignore_empty_entities)
        MyBase.New(id,
                   name,
                   type,
                   bytes_set_string(separator, ignore_empty_entities),
                   AddressOf cached(Of [set](Of String)))
    End Sub

    Public Shared Shadows Function ctor(ByVal id As Int64,
                                        ByVal name As String) As iproperty
        Return New cached_set_string_property(id, name, default_type)
    End Function
End Class
